<?php
class Lemar_Validate_Serveraddress extends Zend_Validate_Abstract {
	private $address;

	function __construct($address) 
	{
		$this->address = $address;
	}

    protected $_messageTemplates = array(
    );	

	public function isValid($value) 
	{
		$a = array();
		$v1 = new Zend_Validate_Ip();
		$v2 = new Zend_Validate_Hostname();
		$val1 = $v1->isValid($value);
		$err1 = $v1->getErrors();
		$mess1 = $v1->getMessages();
		
		foreach($mess1 as $k => $v)
		{
			$a [$k] =  $v;
		}

		
		$val2 = $v2->isValid($value);
		$err2 = $v2->getErrors();
		$mess2 = $v2->getMessages();
		foreach($mess2 as $k => $v)
		{
			$a [$k] =  $v;
		}
		
//		print_r($mess1);
//		print_r($err2);
		
		if ($val1 or $val2)
		{
			return true;
		}		
		else
		{
			$this->_error($err1[0] . '' . $err2[0]);
			$this->_messages = $a; 
			return false;
		}
	}
}